package dao;

import Utils.JDBCUtils;
import beans.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class accountDao {
    public User queryAccount(String username) {
        User existUser = null;
        QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
        try {
            existUser = qr.query("SELECT * FROM `user` WHERE username =?",
                    new BeanHandler<User>(User.class),
                    username);
        }catch (Exception e){
            e.printStackTrace();
        }
        return existUser;
    }
}
